<template>
  <div class="project">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper"></div>

    <!-- 操作按钮区域 -->

    <el-table border
              v-loading="loading"
              size="small"
              :data="dataSource"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              :default-sort = "{prop: 'returnDate', order: 'descending'}">
        <el-table-column prop="companyName" label="领用公司" sortable></el-table-column>
        <el-table-column prop="returnDate" label="归还时间" sortable></el-table-column>
        <el-table-column prop="isDamage" label="是否损坏" sortable></el-table-column>
        <el-table-column prop="returner" label="归还人" sortable></el-table-column>
        <el-table-column prop="telphone" label="联系电话" sortable></el-table-column>
        <el-table-column prop="photo" label="照片" >
          <template>
            <span v-for="(item,index) in photos" :key="index">
              <el-popover
                placement="right"
                title=""
                trigger="hover">
                <img :src="['http://172.16.1.185:8080/asset-server/' + item]" />
                <img slot="reference" :src="['http://172.16.1.185:8080/asset-server/' + item]" :alt="['http://172.16.1.185:8080/asset-server/' + item]" style="max-height: 50px;max-width: 130px">
              </el-popover>
            </span>
          </template>
        </el-table-column>     
        <el-table-column prop="note" label="备注" ></el-table-column>
    </el-table>
    <pagination :total="ipagination.total" :page.sync="ipagination.current" :limit.sync="ipagination.pageSize"
    @pagination="loadData"></pagination>
  </div>
</template>

<script>
  /* eslint-disable */
  import { SingleTableMixins } from '@/mixins/SingleTableMixins'
  import Pagination from '@/components/Pagination'
  import { getAction } from "@/api/manage";



  export default {
    mixins: [ SingleTableMixins ],
    components: {Pagination},
    name: "returnRecord",
    data () {
      return{
        ipagination:{
          pageSize: 10,
          current:1,
          total: 0,
        },
        photos:[],
        disableMixinCreated:true,
        url:{
          list: `/retrocede/listByMainId`
        }
      }
    },
    created () {

    },
    methods: {
      getDataByMain(id) {
        let that = this;
        let each
        this.url.list = `/retrocede/listByMainId/${id}`;
        this.loadData(1);
        getAction(`/retrocede/listByMainId/${id}`).then(res => {
          for(each of res.data.records){
            console.log(each)
            if(each.hasOwnProperty("photo")){
              if(each.photo.search(',') != -1){
              that.photos = each.photo.split(',')
              }else{
                that.photos = each.photo.split(' ')
              }

              console.log(that.photos)

          }

          }

      });
      },
    }
  }
</script>

<style scoped>

</style>
